﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class admin_ManagerOrder : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["adminlogin"] == null)
        {
            Response.Redirect("adminlogin.aspx");
        }
    }
    protected void GridViewOrder_SelectedIndexChanged(object sender, EventArgs e)
    {
        int ID = Convert.ToInt32(GridViewOrder.SelectedValue);
        Response.Redirect("ViewOrderDetails.aspx?ID=" + ID);
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        if (DropDownListSearchOrder.SelectedIndex == 0)
        {
            DataSet2TableAdapters.tbl_orderTableAdapter daOrder = new DataSet2TableAdapters.tbl_orderTableAdapter();
            DataSet2 ds2 = new DataSet2();
            daOrder.Fill(ds2.tbl_order);
            DataTable dt = new DataTable();
            dt = ds2.tbl_order;
            GridViewOrder.DataSourceID = null;
            GridViewOrder.DataSource = dt;
            GridViewOrder.DataBind();
        }
        else
        if (DropDownListSearchOrder.SelectedIndex == 2 || DropDownListSearchOrder.SelectedIndex == 3)
        {
            DataSet2TableAdapters.tbl_orderTableAdapter daOrder = new DataSet2TableAdapters.tbl_orderTableAdapter();
            DataSet2 ds2 = new DataSet2();
            daOrder.FillByWaiting(ds2.tbl_order, DropDownListSearchOrder.SelectedItem.Text);
            DataTable dt = new DataTable();
            dt = ds2.tbl_order;
            GridViewOrder.DataSourceID = null;
            GridViewOrder.DataSource = dt;
            GridViewOrder.DataBind();
        }
        else
        {
            DataSet2TableAdapters.tbl_orderTableAdapter daOrder = new DataSet2TableAdapters.tbl_orderTableAdapter();
            DataSet2 ds2 = new DataSet2();
            daOrder.FillBy(ds2.tbl_order, Convert.ToInt32(TextBox1.Text));
            DataTable dt = new DataTable();
            dt = ds2.tbl_order;

            GridViewOrder.DataSourceID = null;
            GridViewOrder.DataSource = dt;
            GridViewOrder.DataBind();
        }
    }
}
